<?php
class LocationNonLoggedIn extends Zend_Form {
	
	
	public function Location($user) {
		$this->__construct();
	}
	
	public function init() {
		$this->setMethod("POST");
		$this->setName("locationNonLoggedIn");
		
		$cityId = SessionUtil::getProperty(Constant::KEY_CITY_ID);
		if ($cityId == null)
			SessionUtil::setProperty(Constant::KEY_CITY_ID,"1");
		$cityId = SessionUtil::getProperty(Constant::KEY_CITY_ID);
		$countryId = City::getCountry($cityId)->id;
              
        $element = new Zend_Form_Element_Select("country");
        $element->setLabel("Country:");
        $element->addMultiOption(0, "-- Select country --");
        $element->addMultiOptions(Country::getAllCountryAsArray());
        $element->setValue($countryId);
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Select("city");
        $element->setLabel("City:");
        $element->addMultiOption(0, "-- Select city --");
        $element->addMultiOptions(Country::getTopCityByCountryAsArray($countryId));
        $element->setValue($cityId);
        $element->setRegisterInArrayValidator(false);
        $this->addElement($element);
        
        $element = new Zend_Form_Element_Submit("save");
        $this->addElement($element);
	}
}
?>